package com.rsk.utils.result;

public class ResultBuilder {
	
	 //返回成功
    @SuppressWarnings("unchecked")
	public static <T> Result<T> successNoData(ResultCode code){
        Result<T> result = new Result<T>();
        result.setCode(code.getCode());
        result.setMsg(code.getMsg());
        result.setData((T) "");
        return result;
    }
    
    //返回成功带数据
    public static <T> Result<T> success(T t,ResultCode code){
        Result<T> result = new Result<T>();
        result.setCode(code.getCode());
        result.setMsg(code.getMsg());
        result.setData(t);
        return result;
    }

    //返回失败
    @SuppressWarnings("unchecked")
	public static <T> Result<T> faile(ResultCode code){
        Result<T> result = new Result<T>();
        result.setCode(code.getCode());
        result.setMsg(code.getMsg());
        result.setData((T) "");
        return result;
    }
    
}
